-
Notifications
You must be signed in to change notification settings - Fork 983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPs and tokens update #927
Conversation
where is the js? :) On Thu, Oct 3, 2013 at 8:59 PM, Greg Sutcliffe notifications@github.comwrote:
|
I said we might need to do that :P |
managed? and !compute? or (compute? and !compute_resource.provided_attributes.keys.include?(:ip)) | ||
# if it's not managed there's nowhere to specify an IP anyway | ||
return false unless managed? | ||
ip_for_compute = (compute? && compute_resource.provided_attributes.keys.include?(:ip)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the logic on this line be inverted (like the original)? Are we saying that the user has to supply an IP, even if the compute resource supplies it?
Or are we saying that the compute resource has to provide it and we validate that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not so much about presence as format. We're saying that if the compute resource provides an IP, we should validate the supplied data is a valid format (see https://github.com/GregSutcliffe/foreman/blob/3435fde6b81bc8532f0360bd09c10f9f0fbe3512/app/models/host/managed.rb#L145)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense, thanks.
I do think the AJAX idea would be good, and can't really see how we could do it with pure client side validation. Would it though cause more calls to the CR, similar to #936, as we'd need the whole host? There's already a CR selected route which returns some rendered HTML, perhaps that could be changed to a JSON response and we include the validation state alongside. Maybe an additional AJAX call just for validation triggered by domain+subnet selection would complete it? I wonder how much additional load this would put on Foreman. Any better ideas @ohadlevy? |
I guess we could split up the validation. Client-side, we only need to know if the user needs to supply an IP. So we can split this into "require_ip_input?" and "require_ip_validation?". The first method won't involve calls to the CR, and the second will only need to be checked on save. We can then use the first as a base for some AJAX. |
I think the two are very much linked - even knowing if an IP is required will need us to know which CR it is. Most of the AJAX calls work by serialising the entire form, which causes the CR to be instantiated. I'm not sure if it calls the CR for anything though - I got the impression from @ohadlevy's comments the other day that this process does. |
bump, this is becoming important. Do we merge as is, or can someone help me get it where it needs to be? |
Does the AJAX solution outlined in #927 (comment) make sense? |
I think so, although I've never tried to write any ajaxy stuff. I guess I can try to see how the primary tab does it right now, and do some googling |
Have a look at what's there already for CR selection and domain selection - the former returns an HTML view that I think we'd change to JSON so we can pass the IP validation info alongside, while the latter is probably JSON that returns a list of subnets. |
Having played around with this for a while, I think it's a huge amount of overhead to calculate I suggest we had a hover tooltip explaining when an IP is/is not required - is that ok? |
@GregSutcliffe I'm not sure 100% by what you mean is a huge amount of overhead... can you break it down? |
To decide if we require an IP or not, we need to know:
We also need to evaluate this when there are changes to any of these parameters. If we look at the
That's a huge amount of complication for changing some text. In addition, I already have timeout issues around the compute resource parts of the Host form - this will make it worse, I think. A popup helpbox is much easier. |
@domcleal i've just pushed a simple popover that explains when you can ignore the IP box. I've not mentioned CRs since the IP box vanishes entirely then. |
Merged as 01302dc and 385d994, thanks @GregSutcliffe. One issue I hit while testing is that spoof stops working, as the IP is no longer present. I've bumped issue 359 up the backlog in response, particularly as it already has a patch. If you could look at it in the next sprint and add tests to @jfautley's patch, that'd be appreciated. |
#3182
#3196
We might want some kind of AJAX on the IP field to display when it is/isn't required. Otherwise the user may get confused. Conditions are: